﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Engine.Sgml.Validation;
using Engine.Sgml.Schema;

namespace Engine.Sgml.Test.Util {
    class ModelGroupsMatchGeneratorStatistics {
        public int TotalMatchCount { get; set; }
        public int TotalPartialAccordanceMatchCount { get; set; }
        public int TotalFullAccordanceMatchCount { get; set; }
        public int TotalInconsistentMatchCount { get; set; }
        public int TotalRepetitiveModelGroupsCount { get; set; }

        internal void Reset() {
            TotalMatchCount = 0;
            TotalPartialAccordanceMatchCount = 0;
            TotalFullAccordanceMatchCount = 0;
            TotalInconsistentMatchCount = 0;
            TotalRepetitiveModelGroupsCount = 0;
            }

        public void Collect(ModelGroupsMatch match) {
            switch (match.Type) {
                case AccordanceTypes.Inconsistent:
                    TotalInconsistentMatchCount++;
                    break;
                case AccordanceTypes.Partial:
                    TotalPartialAccordanceMatchCount++;
                    break;
                case AccordanceTypes.Full:
                    TotalFullAccordanceMatchCount++;
                    break;
                default:
                    break;
                }
            if (match.Model.CanRecur())
                TotalRepetitiveModelGroupsCount++;
            TotalMatchCount++;
            }

        public void Change(ModelGroupsMatch match, bool additive) {
            switch (match.Type) {
                case AccordanceTypes.Inconsistent:
                    if (additive)
                        TotalInconsistentMatchCount++;
                    else
                        TotalInconsistentMatchCount--;
                    break;
                case AccordanceTypes.Partial:
                    if (additive)
                        TotalPartialAccordanceMatchCount++;
                    else
                        TotalPartialAccordanceMatchCount--;
                    break;
                case AccordanceTypes.Full:
                    if (additive)
                        TotalFullAccordanceMatchCount++;
                    else
                        TotalFullAccordanceMatchCount--;
                    break;
                default:
                    break;
                }
            }
        }
    }
